package com.dao.front.Impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.dao.BaseDao;
import com.dao.front.IMvFrontDao;
@Repository
public class MvDaoFrontImpl extends BaseDao implements IMvFrontDao {

	//以mv为主表查询 mv类型，歌手
	@Override
	public List<Map<String, Object>> findAll() {
		String sql="select mvId,mvName,mvMp4,mvPhoto,m.mvTypeId,m.singerId,"
				+ " mt.mvTypeId,mt.mvTypeName,s.singerId,s.singerName "
				+ " from mv m join mvType mt on m.mvTypeId=mt.mvTypeId "
				+ " join singer s on m.singerId=s.singerId"
				+ " limit 0,16";
		return executeQuery(sql, null);
	}

	@Override
	public List<Map<String, Object>> queryMvType() {
		String sql ="select mvTypeId,mvTypeName from mvtype";
		return executeQuery(sql, null);
	}

	@Override
	public List<Map<String, Object>> queryMvTypeId(int mvTypeId) {
		String sql="select mvId,mvName,mvMp4,mvPhoto,m.mvTypeId,m.singerId,"
				+ " mt.mvTypeId,mt.mvTypeName,s.singerId,s.singerName "
				+ " from mv m join mvType mt on m.mvTypeId=mt.mvTypeId "
				+ " join singer s on m.singerId=s.singerId"
				+ " where mt.mvTypeId=?";
		Object[] params={mvTypeId};
		return executeQuery(sql, params);
	}

}
